FROM golang:1.17.2-alpine as builder
LABEL maintainer="Tianshi <root@iqqbot.com>"

WORKDIR /app
COPY go.mod ./
# this project only container standard library, so it don't have go.sum file, prevent copy file, this example only copy go.mod
#COPY go.mod go.sum ./
RUN go mod download
COPY . .

RUN CGO_ENABLED=0 GOOS=linux go build -o http-server

FROM alpine:3.14
WORKDIR /app/

COPY --from=builder /app/http-server .

EXPOSE 80

CMD ["./http-server"]
